<?php
require_once("../inc/conn.php");
require_once("../inc/session.php");
//获取传递来的id  数组
$getid=$_POST["id"];
$getxm=$_POST["xm"];
$getwx=$_POST["wx"];

//print_r($getxm);
//echo count($getxm);
//echo $str;
//定义批量语句
for($i=0;$i<count($getxm);$i++){
    $sql="update userinfo set name='".$getxm[$i]."',weixin='".$getwx[$i]."' where id = ".$getid[$i];
//执行sql
  $rs=$conn->query($sql);
}


//判断成功是否
if($rs){
	echo "<script>alert('批量更新成功！');location.href='userlist.php';</script>";
}else{
	echo "<script>alert('批量更新失败！');location.href='userlist.php';</script>";
}
?>